home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Utilities
/
Workspace
/
PasteboardInspector
/
Source
/
PSView.m
< prev
Wrap
Text File
|
1995-06-12
|
1KB
|
76 lines
#import <appkit/NXImage.h>
#import <appkit/NXBitmapImageRep.h>
#import <appkit/NXEPSImageRep.h>
#import <appkit/ScrollView.h>
#import <appkit/Matrix.h>
#import <dpsclient/psops.h>
#import "PSView.h"
@implementation PSView
- initFrame:(NXRect *)r
{
self = [super initFrame:r];
displayType = 0;
sizedirty = YES;
return self;
}
- getImage
{
return theImage;
}
- setImage: image
{
if(theImage != nil)
[theImage free];
theImage = image;
[theImage setDataRetained:YES];
[theImage setScalable:YES];
[theImage getSize:&s];
return self;
}
- drawSelf:(const NXRect *)aRect :(int)c
{
NXCoord width, height;
NXPoint p;
PSsetgray(NX_LTGRAY);
NXRectFill(aRect);
if(displayType == 0)
{
width = ((s.width < bounds.size.width) ? bounds.size.width : s.width);
height = ((s.height < bounds.size.height) ? bounds.size.height : s.height);
if(sizedirty)
{
[theImage setSize:&s];
sizedirty = NO;
}
p.x = width / 2 - s.width / 2;
p.y = height / 2 - s.height / 2;
[theImage composite: NX_COPY toPoint: &p];
}
else
{
[theImage setSize:&bounds.size];
[theImage composite: NX_COPY toPoint: &bounds.origin];
}
return self;
}
- setGraphicDisplayType: sender
{
displayType = [sender selectedTag];
sizedirty = YES;
[self display];
return self;
}
@end